import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import { isMobile } from './utils/device'

// 按需导入UI框架
import { vantPlugins } from './plugins/vant'
import { elementPlugins } from './plugins/element'

// 导入自定义指令
import intersectionObserver from './directives/intersection-observer'

import './assets/styles/main.scss'

const app = createApp(App)

// 注册自定义指令
app.directive('intersection-observer', intersectionObserver)

// 根据设备类型加载对应的UI框架
if (isMobile()) {
  vantPlugins(app)
} else {
  elementPlugins(app)
}

app.use(createPinia())
app.use(router)
app.mount('#app') 